package com.ly.wxstore.service;

import java.util.List;

import javax.transaction.Transactional;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ly.wxstore.entity.Image;
import com.ly.wxstore.repository.ImageDao;

/**
 * 
 * 
 * @author Peter
 */
// Spring Service Bean的标识.
@Component
public class ImageService {

	private static Logger logger = LoggerFactory.getLogger(ImageService.class);

	@Autowired
	private ImageDao imageDao;

	public Image getById(Long id) {
		return imageDao.getById(id);
	}

	public List<Image> search(Image image) {
		return imageDao.search(image);
	}
	
	/**
	 * add by huyaonan 20150715
	 * @param image
	 * @return
	 */
	public List<Image> searchByCode(Image image) {
		return imageDao.searchByCode(image);
	}

	@Transactional
	public void save(Image image) {
		imageDao.save(image);
	}

	public void update(Image image) {
		imageDao.update(image);
	}

	/**
	 * 软删除
	 */
	public void delete(Long id) {
		imageDao.delete(id);
	}

	public Image getByUuid(String uuid) {
		return imageDao.getByUuid(uuid);
	}

	@Transactional
	public void deleteByUuid(String uuid) {
		imageDao.deleteByUuid(uuid);
		
	}

	//---------------------------------------------------------------------------
	public List<Image> getByUid(String uid) {
		return imageDao.getByUid(uid);
	}
}
